#pragma once
#ifndef __G_PLANE_H__
#define __G_PLANE_H__

#include "GVector3.h"
#include "GUtilities/GTypes.h"

namespace GMath
{

	enum GHalfSpaceResult
	{
		G_HSR_NEGATIVE	= 0,
		G_HSR_POSITIVE	= 1,
		G_HSR_ON_PLANE	= 2
	};

	class GPlane
	{
	public:
		GVector3			Point;
		GVector3			Normal;
	
							GPlane();
							GPlane(float A, float B, float C, float D);
							GPlane(const GVector3& Point, const GVector3& Normal);
							GPlane(const GVector3& Point0, const GVector3& Point1, const GVector3& Point2);

		void				Create(float A, float B, float C, float D);
		void				Create(const GVector3& Point, const GVector3& Normal);
		void				Create(const GVector3& Point0, const GVector3& Point1, const GVector3& Point2);
		
		void				GetCoefficients(OUTPUT float& A, OUTPUT float& B, OUTPUT float& C, OUTPUT float& D) const;

		GHalfSpaceResult	HalfSpace(const GVector3& TestPoint);

		float				Distance(const GVector3& Point);

	};

}

#endif